package com.google.code.jmarias.client.phases;

import com.google.code.jmarias.client.Entity;
import com.google.code.jmarias.client.Globals;
import com.google.code.jmarias.client.GameLocals;
import com.google.code.jmarias.client.tcp.RemoteServer;
import java.util.ArrayList;
import java.util.List;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Input;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.StateBasedGame;

/**
 * Umozni hraci vybrat typ hry, kterou chce hrat.
 * @author bart
 */
public class AskForChoicePhase extends AbstractPhase {
    private List<Class> allowedActions = new ArrayList<Class>();
    private ArrayList<Entity> actionButtons = new ArrayList<Entity>();


    public AskForChoicePhase(RemoteServer server, Globals globals, GameLocals locals, List<Class> allowedActions) throws SlickException {
        this.server = server;
        this.globals = globals;
        this.locals = locals;

        this.allowedActions = allowedActions;

        // Vytvoreni tlacitek
        actionButtons = createActionButtons(allowedActions);
    }

    @Override
    public void update(GameContainer gc, StateBasedGame sb, int delta) throws SlickException {
        Input input = gc.getInput();

        // Obsluha pohybu mysi nad tlacitkama
        controlActionButtons(input, actionButtons, allowedActions);
        updateActionButtons(actionButtons, gc, sb, delta);



    }

    @Override
    public void render(GameContainer gc, StateBasedGame sb, Graphics gr) throws SlickException {

        renderActionButtons(actionButtons, gc, sb, gr);


    }

}
